<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="itheima" uri="http://systop.com/common/"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script
	src="${pageContext.request.contextPath }/js/jquery-1.11.3.min.js"
	charset="utf-8"></script>
<!--[if lt IE 9]>
    <script src="http://cdn.static.runoob.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/css/bootstrap.min.css">
<style>
#back {
	background-image:
		url(${pageContext.request.contextPath }/images/sun.png);
	background-size: 100%;
	background-repeat: no-repeat;
}

#body {
	background: #ffe;
	width: 1000px;
	margin: 0 auto;
	height: 100%;
	border-radius: 10px;
}

.table>thead>tr>th {
	text-align: center;
}

.order {
	float: right;
}

.fixed-bottom {
	position: fixed;
	bottom: 0;
	width: 100%;
}
</style>
<script type="text/javascript">
	$(function() {
		function footerPosition() {
			$("footer").removeClass("fixed-bottom");
			//网页正文全文高度
			var contentHeight = document.body.scrollHeight,
			//可视窗口高度，不包括浏览器顶部工具栏
			winHeight = window.innerHeight;
			if (!(contentHeight > winHeight)) {
				//当网页正文高度小于可视窗口高度时，为footer添加类fixed-bottom
				$("footer").addClass("fixed-bottom");
			} else {
				$("footer").removeClass("fixed-bottom");
			}
		}
		footerPosition();
		$(window).resize(footerPosition);
	});
	$(function() {
		function footerPosition() {
			$("footer").removeClass("fixed-bottom");
			//网页正文全文高度
			var contentHeight = document.body.scrollHeight,
			//可视窗口高度，不包括浏览器顶部工具栏
			winHeight = window.innerHeight;
			if (!(contentHeight > winHeight)) {
				//当网页正文高度小于可视窗口高度时，为footer添加类fixed-bottom
				$("footer").addClass("fixed-bottom");
			} else {
				$("footer").removeClass("fixed-bottom");
			}
		}
		footerPosition();
		$(window).resize(footerPosition);
	});
</script>
</head>
<body id="back">
	<!-- 头部区域 S-->
	<div>
		<header>
			<nav class="navbar navbar-inverse" role="navigation">
				<div class="container">
					<div class="navbar-header">
						<a class="navbar-brand" href="${pageContext.request.contextPath }/Message/allMess">卓捷电子留言系统</a>
					</div>
					<div class="row">
						<ul class="nav navbar-nav order">
							<li class="active"><a href="${pageContext.request.contextPath }/Message/allMess">首页</a></li>
							<li><a
								href="${pageContext.request.contextPath }/Message/toNewMess">新留言</a></li>
							<li><a href="#"
								style="${sessionScope.user==null?'':'display:none'}">注册</a></li>
							<li><a
								href="${pageContext.request.contextPath }/User/tologin"
								style="${sessionScope.user==null?'':'display:none'}">登录</a></li>
							<li class="dropdown"><a href="#" class="dropdown-toggle"
								style="${sessionScope.user==null?'display:none':''}"
								data-toggle="dropdown" role="button" aria-haspopup="true"
								aria-expanded="false">${userName}<span class="caret"></span></a>
								<ul class="dropdown-menu">
									<li><a
										href="${pageContext.request.contextPath }/User/exit">退出登录</a></li>
								</ul></li>
						</ul>
					</div>
				</div>
			</nav>
		</header>
		<!-- 头部区域 E-->
		<!-- 中间区域S -->
		<article id="body">
			<c:choose>
				<c:when test="${fn:length(page.result)>0}">
					<table class="table table-striped">
						<thead style="vertical-align: middle !important;">
							<tr>
								<th>标题</th>
								<th>作者</th>
								<th>点击量</th>
								<th>回复量</th>
								<th>最后回复时间</th>
								<th>最后回复作者</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${page.result }" var="info">
								<tr style="text-align: center;">
									<td><a
										href="${pageContext.request.contextPath }/Message/showTitleInfo/${info.messId}">${info.titleName }</a></td>
									<td>${info.author }</td>
									<td>${info.clickNum }</td>
									<td>${info.replyNum  }</td>
									<td>${info.reply.replyTime}</td>
									<td>${info.reply.replyAuthor }</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div class="col-md-12 text-right">
						<center>
							<itheima:page
								url="${pageContext.request.contextPath }/Message/allMess" />
						</center>
					</div>
				</c:when>
				<c:otherwise>
					<div style="text-align: center; margin: 50px 0; font-size: 18px;">
						抱歉,没有找到相关用户信息</div>
				</c:otherwise>
			</c:choose>
		</article>
		<!-- 中间区域E -->
		<!-- 尾部区域S -->
		<!-- 尾部区域E -->
	</div>
</body>
</html>